﻿<div class="k-block divToolbar" style="margin: 5px">
    <div style="display: inline-block;">
        <select id="selArchive" style="width: 300px"></select>
    </div>
    <div style="display: inline-block;">
        <select id="selSubject" style="width: 220px"></select>
    </div>
    <div style="display: inline-block;">
        <select id="selSchool"></select>
    </div>
    <button class="k-button" onclick="Filter()"><span class="k-icon k-i-search"></span><span>搜索</span></button>
</div>
<div class="ph-tabs">
    <ul>
        <li class="k-state-active">成绩计数统计</li>
        <li>成绩明细列表</li>
    </ul>
    <div>
        <div id="grid_statistic" style="text-align: center"></div>
    </div>
    <div>
        <div id="grid_marks" style="text-align: center"></div>
    </div>
</div>

<script class="init">
    LocatedMenu("体质健康", "成绩情况");

    $("#selArchive").kendoDropDownList({
        dataTextField: "Title",
        dataValueField: "Guid",
        dataSource: Whale.dataSource({
            url: "/Achievements/Archive/Gets",
            getParameters: function () {
                return {
                    aType: 2,
                    bureauID: "@PH.Web.Global.WebContext.CurrentUser.AssociatedBureauID"
                };
            }
        })
    });
    $("#selSchool").kendoDropDownList({
        optionLabel: {
            Guid: "",
            SchoolName: "所有学校"
        },
        dataTextField: "SchoolName",
        dataValueField: "Guid",
        dataSource: Whale.dataSource({
            url: "/School/SchoolInfo/GetSchoolList"
            //getParameters: function () {
            //    return {
                   
            //    };
            //}
        })
    });

    $("#selSubject").kendoDropDownList({
        optionLabel: {
            ID: 0,
            SubjectName: "所有项目"
        },
        dataTextField: "SubjectName",
        dataValueField: "ID",
        dataSource: Whale.dataSource({
            url: "/Standard/Subject/GetSubjects"
        })
    });

    function Filter() {
        $("#grid_statistic").data("kendoGrid").dataSource.page(0);
        $("#grid_marks").data("kendoGrid").dataSource.page(0);
    }
</script>

<script class="grid_statistic_config">
    $(function () {
        var fields = [{
            title: "学校",
            field: "SchoolName",
            width:250
        }, {
            title: "年级",
            field: "GradeCode",
            template: "#=GetGradeString(GradeCode)#",
            width: 100
        }, {
            title: "项目",
            field: "SubjectName",
            width: 200
        }, {
            title: "实际人数",
            field: "PersonCount",
            width: 100
        }, {
            title: "成绩个数",
            field: "MarkCount",
            width: 100
        }, {
            title: "差额",
            template: "#=PersonCount-MarkCount#",
            width: 100
        }, {}];

        $("#grid_statistic").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Achivevments/Mark/GetMarkStatisticBySchool",
                getParameters: function () {
                    var sid = $("#selSubject").data("kendoDropDownList").value();
                    return {
                        aGuid: $("#selArchive").data("kendoDropDownList").value(),
                        sGuid: $("#selSchool").data("kendoDropDownList").value(),
                        subjectID: sid == "" ? 0 : sid
                    };
                },
                pageSize: 20

            }),
            pageable: {
                messages: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });
</script>

<script class="grid_marks_config">
    $(function () {
        var fields = [{
            title: "身份证",
            field: "StudentNo",
            width: 150
        }, {
            title: "学校",
            field: "SchoolName",
            width: 200
        }, {
            title: "姓名",
            field: "StudentName",
            width: 100
        }, {
            title: "性别",
            field: "Sex",
            template: "#=GetSexString(Sex)#",
            width: 60
        }, {
            title: "项目",
            field: "Subject.SubjectName",
            width: 200
        }, {
            title: "成绩",
            field: "Achievement",
            width: 100
        }, {
            title: "得分",
            field: "Score",
            width: 60
        }, {
            title: "评价",
            field: "Description",
            width: 100
        }, {}];

        $("#grid_marks").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Achivevments/Mark/Gets",
                getParameters: function () {
                    var sid = $("#selSubject").data("kendoDropDownList").value();
                    return {
                        aGuid: $("#selArchive").data("kendoDropDownList").value(),
                        sGuid: $("#selSchool").data("kendoDropDownList").value(),
                        subjectID: sid == "" ? 0 : sid,
                        getSubject: true
                    };
                },
                pageSize: 20

            }),
            pageable: {
                messages: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });
</script>
